{extend name="platform/base" /}
{block name="resources"/}
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/defau.css">
<style>
.table-input{
	height:12px !important;
	line-height:12px !important;
	width:30px;
	margin-bottom:0px !important;
}
</style>
{/block}
{block name="main"}
<div class="mod-table">
	<div class="mod-table-head">
		<div class="con style0list">
			<table>
				<colgroup>
					<col style="width: 20%;">
					<col style="width: 40%;">
					<col style="width: 40%;">					
				</colgroup>
				<thead>
					<tr>
						<th>代理级别</th>						
						<th>各级奖励比例</th>
						<th>升级条件</th>						
					</tr>
				</thead>
				<colgroup>
					<col style="width: 20%;">
					<col style="width: 40%;">
					<col style="width: 40%;">		
				</colgroup>
				<tbody  id="partner_global">
				
				    <tr align="center" >
						<td>省级代理</td>
						<td><input  class="table-input" type="text" id="province_rate"value="{$region_agent_info.province_rate}" />%</td>
						<td><input  class="table-input"  type="text" id="application_require_province"value="{$region_agent_info.application_require_province}" /></td>						
					</tr>					
					<tr align="center" >
						<td>市级代理</td>
						<td><input  class="table-input" type="text" id="city_rate"value="{$region_agent_info.city_rate}" />%</td>
						<td><input  class="table-input"  type="text" id="application_require_city"value="{$region_agent_info.application_require_city}" /></td>						
					</tr>
					<tr align="center" >
						<td>区级代理</td>
						<td><input  class="table-input" type="text" id="district_rate"value="{$region_agent_info.district_rate}" />%</td>
						<td><input  class="table-input"  type="text" id="application_require_district"value="{$region_agent_info.application_require_district}" /></td>						
					</tr>
				</tbody>
			</table>
		</div>
	</div>
	<button class="edit_button" onclick="UpdateShopRegionAgentConfig();">提交</button>
</div>
{include file="admin/default/openDialog" /}
<script>		
function UpdateShopRegionAgentConfig(){
	var province_rate=$("#province_rate").val();
	var application_require_province=$("#application_require_province").val();
	var city_rate=$("#city_rate").val();
	var application_require_city=$("#application_require_city").val();
	var district_rate=$("#district_rate").val();
	var application_require_district=$("#application_require_district").val();
	
	if((parseFloat(province_rate) +parseFloat(city_rate)+ parseFloat(district_rate))>100 ){
		showMessage('error', "佣金比率不可超过100%！");	
		return false;
	}
	$.ajax({
		type:"post",
		url:"PLATFORM_MAIN/Distribution/UpdateShopRegionAgentConfig",
		data:{
			'province_rate':province_rate,
			'application_require_province':application_require_province,
			'city_rate':city_rate,
			'application_require_city':application_require_city,
			'district_rate':district_rate,
			'application_require_district':application_require_district
		},
		async:true,
		success:function (data) {
			if (data["code"] > 0) {
				showMessage('success', data["message"],"PLATFORM_MAIN/Distribution/UpdateShopRegionAgentConfig");
			}else{
				showMessage('error', data["message"]);
			}	
		}
	});
}

</script>
{/block}